Skip to content

Conversation

@user202729
Copy link
Contributor

Fix #30379 .

The implementation mimic acb_calc_func_callback.

also increase tolerance for a few parts, since the CI system is somewhat unreliable (I've seen a 2.00 being 2.04). I guess 0.1s is still considered almost imperceptible by human.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@github-actions
Copy link

github-actions bot commented Oct 4, 2025

Documentation preview for this PR (built with commit b66d785; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@tobiasdiez
Copy link
Contributor

Just got this:

src/bin/sage -t --warn-long 5.0 --random-seed=13341543192946447292488981102614601354 src/sage/doctest/util.py
**********************************************************************
Error: Failed example:: Got: 
cysignals.signals.AlarmInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/forker.py", line 734, in _run
    self.compile_and_execute(example, compiler, test.globs)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/forker.py", line 1158, in compile_and_execute
    exec(compiled, globs)
    ~~~~^^^^^^^^^^^^^^^^^
  File "<doctest sage.doctest.util.inaccuracy_tolerance[12]>", line 1, in <module>
    with ensure_interruptible_after(Integer(1)): uninterruptible_sleep(2); raise RuntimeError
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/util.py", line 897, in ensure_interruptible_after
    raise RuntimeError(
            f"Function is not interruptible within {seconds:.4f} seconds, only after {elapsed:.4f} seconds"
            + ("" if alarm_raised else " (__exit__ called before interrupt check)"))
RuntimeError: Function is not interruptible within 1.0000 seconds, only after 2.1566 seconds

    with ensure_interruptible_after(1): uninterruptible_sleep(2r); raise RuntimeError
Expected:
    Traceback (most recent call last):
    ...
    RuntimeError: Function is not interruptible within 1.0000 seconds, only after 2.00... seconds
Got:
    <BLANKLINE>
    cysignals.signals.AlarmInterrupt
    <BLANKLINE>
    During handling of the above exception, another exception occurred:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/forker.py", line 734, in _run
        self.compile_and_execute(example, compiler, test.globs)
        ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/forker.py", line 1158, in compile_and_execute
        exec(compiled, globs)
        ~~~~^^^^^^^^^^^^^^^^^
      File "<doctest sage.doctest.util.inaccuracy_tolerance[12]>", line 1, in <module>
        with ensure_interruptible_after(Integer(1)): uninterruptible_sleep(2); raise RuntimeError
             ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
      File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/contextlib.py", line 162, in __exit__
        self.gen.throw(value)
        ~~~~~~~~~~~~~~^^^^^^^
      File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/util.py", line 897, in ensure_interruptible_after
        raise RuntimeError(
                f"Function is not interruptible within {seconds:.4f} seconds, only after {elapsed:.4f} seconds"
                + ("" if alarm_raised else " (__exit__ called before interrupt check)"))
    RuntimeError: Function is not interruptible within 1.0000 seconds, only after 2.1566 seconds
**********************************************************************
1 item had failures:
   1 of  17 in sage.doctest.util.inaccuracy_tolerance

https://github.com/sagemath/sage/actions/runs/18576442855/job/52962606814

so the increase in tolerance would be not enough. Maybe there is an actual issue here?

@user202729
Copy link
Contributor Author

sounds like one of these extremely-difficult-to-debug issue. Given that I also can't reproduce it internally, I'd guess that GitHub CI machines are some virtual machine thing and may need to compete with other virtual machines concurrently running, which would explain the (extreme) fluctuation.

@user202729
Copy link
Contributor Author

I suspect garbage collector. Let's see if #41072 helps.

@user202729
Copy link
Contributor Author

that 2.1566 is unrelated to the change in this pull request (add sig_block) though.

vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 26, 2025
sagemathgh-40980: Call sig_block() in integral callback
    
Fix sagemath#30379 .

The implementation mimic `acb_calc_func_callback`.

also increase tolerance for a few parts, since the CI system is somewhat
unreliable (I've seen a 2.00 being 2.04). I guess 0.1s is still
considered almost imperceptible by human.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40980
Reported by: user202729
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 1, 2025
sagemathgh-40980: Call sig_block() in integral callback
    
Fix sagemath#30379 .

The implementation mimic `acb_calc_func_callback`.

also increase tolerance for a few parts, since the CI system is somewhat
unreliable (I've seen a 2.00 being 2.04). I guess 0.1s is still
considered almost imperceptible by human.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40980
Reported by: user202729
Reviewer(s):
@vbraun
Copy link
Member

vbraun commented Dec 1, 2025

There is a tolerance missing on this test

**********************************************************************
File "src/sage/doctest/util.py", line 846, in sage.doctest.util.inaccuracy_tolerance
Failed example:
    with ensure_interruptible_after(2) as data: interruptible_sleep(1r)
Expected:
    Traceback (most recent call last):
    ...
    RuntimeError: Function terminates early after 1.00... < 2.0000 seconds
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 734, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 1158, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.doctest.util.inaccuracy_tolerance[9]>", line 1, in <module>
        with ensure_interruptible_after(Integer(2)) as data: interruptible_sleep(1)
      File "/Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/lib/python3.12/contextlib.py", line 144, in __exit__
        next(self.gen)
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/util.py", line 904, in ensure_interruptible_after
        raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds")
    RuntimeError: Function terminates early after 0.9982 < 2.0000 seconds
**********************************************************************

@cxzhong
Copy link
Contributor

cxzhong commented Dec 5, 2025

There is a tolerance missing on this test

**********************************************************************
File "src/sage/doctest/util.py", line 846, in sage.doctest.util.inaccuracy_tolerance
Failed example:
    with ensure_interruptible_after(2) as data: interruptible_sleep(1r)
Expected:
    Traceback (most recent call last):
    ...
    RuntimeError: Function terminates early after 1.00... < 2.0000 seconds
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 734, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 1158, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.doctest.util.inaccuracy_tolerance[9]>", line 1, in <module>
        with ensure_interruptible_after(Integer(2)) as data: interruptible_sleep(1)
      File "/Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/lib/python3.12/contextlib.py", line 144, in __exit__
        next(self.gen)
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/util.py", line 904, in ensure_interruptible_after
        raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds")
    RuntimeError: Function terminates early after 0.9982 < 2.0000 seconds
**********************************************************************

This has been fixed now in my PR #41263. And seems unrelevant with this PR. So I set it to positive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surprising error in numerical integration

4 participants